/**
 * API接口文件，此处定义所有API接口
 */
let express = require('express');

let location = require('./common/location');
let tools = require('./common/tools');
let topicController = require('./controllers/topic');
let router = express.Router();


/**
 * example
 * URL topics:
 *
 *  GET    /topics[/]        => topicController.list()
 *  GET    /topics/new       => topicController.new()
 *  GET    /topics/:id       => topicController.show()
 *  GET    /topics/:id/edit  => topicController.edit()
 *  POST   /topics[/]        => topicController.create()
 *  PATCH  /topics/:id       => topicController.update()
 *  DELETE /topics/:id       => topicController.destroy()
 */

//帖子
router.get('/topics/new', topicController.new);
router.get('/topics/:id/edit', topicController.edit);

router.route('/topics/')
  .get(topicController.list)
  .post(topicController.create);

router.route('/topics/:id')
  .get(topicController.show)
  .patch(topicController.update)
  .delete(topicController.destroy);



module.exports = router;